MLB Lineup Analyzer

Web App
Data Science
Java
UI Design
Authors

Document Written By: Hannah Hollrah

Project Member: Carson Gruenloh

Project Member: Cason Canning

Published

May 3, 2026

Project Overview

The MLB Lineup Analyzer is an interactive web application my team and I built to explore how different Major League Baseball players would perform together in a batting lineup. Using real 2022 MLB Statistics, the app allows user to:

The goal was to create a tool that is simple for anyone to use, even without baseball analytics experience, while still producing a meaningful, data-driven result.

Motivation

Baseball lineups are surprisingly complex. A team’s success depends not only on individual player skill but also how well players are arranged in a batting order. We wanted to build a tool that makes this strategic decision-making accessible and interactive. At the end of the day, our motivation came from three places: curiosity, data exploration, and software engineering practice.

What the App Looks Like

Upon opening the app, you see this ‘Lineup Predictor’ page. On the left-hand side of the screen, you can see two options: Lineup Predictor, and Lineup Optimizer.

If you toggle with the links on the left-side of the screen, you will be brought to ‘Lineup Optimizer’.

How the App Works

We designed the app to feel simple on the surface, but behind the scenes it uses several layers of logic:

  1. Cleaned and Prepared MLB Data

    We started with the 2022 MLB dataset from Kaggle. We cleaned it by:

    • Removing duplicate rows

    • Normalizing player names

    • Filtering out players with zero plate appearances

    • Adding a position column

    This ensures the UI dropdowns only show valid players for each position.

  2. Offensive Score Calculation

    When a user builds a lineup in ‘Lineup Predictor’, the app calculated a predicted “offensive score.” This score is based on four key stats:

    • OBP (on-base percentage)

    • SLG (slugging percentage)

    • HR (home runs)

    • BB (walks)

    We weighted these stats based on how strongly they contribute to run scoring. Higher score = stronger lineup.

  3. Lineup Optimization

    If the user chooses the Optimizer tool:

    • They select any nine players

    • The app generated thousands of possible batting orders

    • Each order is scored

    • The highest-scoring lineup is returned

    This gives the user a data-driven “best possible” batting order.

  4. Web Interface

    We built the UI using Vaadin, which allowed us to create:

    • Dropdown menus filtered by position

    • A multi-select list for choosing players

    • A clean layout with a sidebar menu

    • Automatic display of results and predicted scores

    The app runs locally and opens directly in the browser.

Key Findings

While testing and experimenting with the tool, we noticed several interesting patterns:

What I learned

This project strengthened my skills in:

It also taught me how important it is to design software that is both functional and intuitive for users.

Final Thoughts

The MLB Lineup Analyzer was one of the most rewarding projects I’ve worked on. It combines data science, sports analytics, and full-stack development into a single interactive tool. While it isn’t meant for professional use, it provides a fun and insightful way to explore baseball strategy and understand how different players contribute to a lineup.